HAL JPEG constants migration

This section provides information about HAL JPEG constants for STM32 HAL1 to HAL2 migration.

HAL JPEG error code constants

HAL1

HAL2

#define HAL_JPEG_ERROR_DMA
#define HAL_JPEG_ERROR_NONE
#define HAL_JPEG_ERROR_INVALID_CALLBACK
#define HAL_JPEG_ERROR_TIMEOUT

#define HAL_JPEG_ERROR_QUANT_TABLE
#define HAL_JPEG_ERROR_HUFF_TABLE
#define HAL_JPEG_ERROR_DMA
#define HAL_JPEG_ERROR_NONE
Removed : These kinds of logical errors
are reported by direct function return.

Removed as the huffman table is fully handled internally by the driver.
Removed in case of quantization table setting error, the corresponding function will return HAL_INVALID_PARAM.

Related concept:


HAL JPEG subsampling factors and color space options constants

HAL1

HAL2








#define JPEG_GRAYSCALE_COLORSPACE
#define JPEG_CMYK_COLORSPACE
#define JPEG_YCBCR_COLORSPACE

In HAL1, if you choose the YCBCR colorspace, you must also select one of the following subsampling types.


#define JPEG_444_SUBSAMPLING
#define JPEG_422_SUBSAMPLING
#define JPEG_420_SUBSAMPLING

In HAL2, the YCBCR color space and chroma subsampling are combined into a single enumeration value, enabling both to be configured with one setting instead of separately.

typedef enum
{
  HAL_JPEG_IN_FORMAT_GRAYSCALE,
  HAL_JPEG_IN_FORMAT_CMYK,









  HAL_JPEG_IN_FORMAT_YCBCR_444,
  HAL_JPEG_IN_FORMAT_YCBCR_422,
  HAL_JPEG_IN_FORMAT_YCBCR_420,
} hal_jpeg_input_format_t;

Related concepts:


HAL JPEG status flags constants

HAL1

HAL2

#define JPEG_FLAG_ALL
#define JPEG_FLAG_COF
#define JPEG_FLAG_EOCF
#define JPEG_FLAG_HPDF
#define JPEG_FLAG_IFNFF
#define JPEG_FLAG_IFTF
#define JPEG_FLAG_OFNEF
#define JPEG_FLAG_OFTF
#define HAL_JPEG_FLAG_ALL
#define HAL_JPEG_FLAG_CO
#define HAL_JPEG_FLAG_EOC
#define HAL_JPEG_FLAG_HPD
#define HAL_JPEG_FLAG_IFNF
#define HAL_JPEG_FLAG_IFT
#define HAL_JPEG_FLAG_OFNE
#define HAL_JPEG_FLAG_OFT

HAL JPEG image quality settings constants

HAL1

HAL2

#define JPEG_IMAGE_QUALITY_MAX
#define JPEG_IMAGE_QUALITY_MIN
#define HAL_JPEG_IMAGE_QUALITY_MAX
#define HAL_JPEG_IMAGE_QUALITY_MIN

HAL JPEG interrupt identifiers constants

HAL1

HAL2

#define JPEG_IT_EOC
#define JPEG_IT_HPD
#define JPEG_IT_IFNF
#define JPEG_IT_IFT
#define JPEG_IT_OFT
#define JPEG_IT_OFNE
#define HAL_JPEG_IT_EOC
#define HAL_JPEG_IT_HPD
#define HAL_JPEG_IT_IFNF
#define HAL_JPEG_IT_IFT
#define HAL_JPEG_IT_OFT
#define HAL_JPEG_IT_OFNE

HAL JPEG pause and resume modes constants

HAL1

HAL2

#define JPEG_PAUSE_RESUME_INPUT
#define JPEG_PAUSE_RESUME_INPUT_OUTPUT
#define JPEG_PAUSE_RESUME_OUTPUT

Removed; replaced by separate functions to pause or resume the input or output buffers separately. For more details, see : HAL JPEG resume processing and HAL JPEG pause processing.


HAL JPEG quantization table size constants

HAL1

HAL2

#define JPEG_QUANT_TABLE_SIZE
#define HAL_JPEG_QUANT_TABLE_SIZE